Skip to content

fix: Sph profile inverse transform name-check asymmetry - #557

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/sph-transform-name-check
Aug 6, 2026
Merged

fix: Sph profile inverse transform name-check asymmetry#557
Jammy2211 merged 1 commit into
mainfrom
feature/sph-transform-name-check

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

EllProfile.transformed_from_reference_frame_grid_from checked self.__class__.__name__.startswith("Sph") while its mirror transformed_to_reference_frame_grid_from checks endswith("Sph"). Spherical profiles are suffix-named (IsothermalSph, NFWSph, ...) and no concrete class starts with "Sph", so the inverse transform's spherical branch never fired — every spherical profile took the elliptical rotation path. Numerically benign today (spherical profiles have angle = 0, an exact identity rotation), but the transforms were asymmetric and the inverse did wasted rotation work on the hot path. Fixed to endswith("Sph"); a stack-wide sweep (PyAutoGalaxy/PyAutoLens/PyAutoArray/PyAutoFit) confirms this was the only occurrence of the pattern.

Known residual: IsothermalSphMLR (name ends "MLR") is missed by both name checks and continues down the elliptical path — numerically correct, flagged here rather than inventing a new dispatch mechanism for one class.

Closes #555.

API Changes

None — internal changes only.

Test Plan

  • New regression test test__sph_named_profile__both_transforms_use_translation_only_path asserts (via mock) that neither transform calls the rotation helper for a suffix-named spherical profile. Control-verified: fails on the unfixed source, passes with the fix.
  • test_autogalaxy/profiles: 619 passed.
  • Full test_autogalaxy suite run at ship time (counts in PR checks / ship log).
Full API Changes (for automation & release notes)

None — internal changes only. No public symbols added, removed, renamed, or changed in signature; numerical results unchanged (the previously-taken elliptical path applied an exact identity rotation).

Ship gate note

Shipped with explicit human authorization under Heart RED — reason release validation FAILED (stage integrate), an unrelated in-flight release-validation run; this change was uncommitted at the time of that verdict. Merge remains a separate human decision.

Generated by the PyAutoLabs agent workflow.

@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Aug 6, 2026
@Jammy2211
Jammy2211 merged commit 66fe21c into main Aug 6, 2026
@Jammy2211
Jammy2211 deleted the feature/sph-transform-name-check branch August 6, 2026 20:31
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Sph profile transform startswith/endswith name-check asymmetry

1 participant